#ifndef __CONTROL_H__
#define __CONTROL_H__


#include <stdint.h>
#include "auto_report.h"
typedef struct _control_data_t
{
	uint8_t * dev_mode;
	uint8_t * t_id;
	uint8_t valid_id;
	uint8_t gid_num;
	uint8_t gid_byte_num;
	uint8_t  my_id[ID_LEN];
  uint8_t  default_report;
}control_data_t;


typedef struct _control_flag_t
{
	uint8_t close_sended;
	uint8_t open_sended;
	uint8_t open_close_sence;
	uint8_t close_delay;
    uint8_t report_delay;
}control_flag_t;

typedef struct _control_sensor_t
{
	uint16_t cur_lux;
	uint8_t  cur_lux_pct;
	uint8_t  body_state;
	uint8_t  close_thr;
	uint8_t  open_thr;
	uint8_t  close_delay_time;
}control_sensor_t;

typedef struct _control_counter_t
{
	uint32_t judge_delay;
	uint8_t open_try_cnt;
	uint8_t close_try_cnt;
	uint32_t close_delay;
}control_counter_t;

void local_control_init(uint8_t my_id[],uint8_t valid_id,uint8_t gid_num,uint8_t gid_byte_num, uint8_t t_id[],uint8_t *mode_object);
uint8_t local_control_frame_ack(uint8_t data[], uint8_t len);
void local_control_100ms_task(void);
void local_control_sec_task(void);
uint8_t local_control_get_report_delay_flag(void);
void local_control_clear_report_delay_flag (void);
#endif
